using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using SiteECSWeb;

public partial class AdminMang_AdminDefault : PageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            #region SiteMap
            this.SiteMapNodeProvider = SiteMapProviderNames.TopSubMXmlSiteMapProvider.ToString();
            SiteMapPath1.SiteMapProvider = SiteMapNodeProvider;
            #endregion

            #region BadOnce
            if (Page.User.Identity.IsAuthenticated)
            {
                if (string.Compare(Page.User.Identity.Name,"corp") == 0 )
                {
                    pnlCorp.Visible = true;
                }
                else
                {
                    pnlCorp.Visible = false;
                }
                if (Roles.IsUserInRole(Page.User.Identity.Name,RolesName.Offices.ToString()))
                {
                    HyperLink hylkOffExpOppStics = LoginView1.FindControl("hylkOffExpOppStics") as HyperLink;
                    HyperLink hylkOffTenderStics = LoginView1.FindControl("hylkOffTenderStics") as HyperLink;
                    HyperLink hylkOffMStudyStics = LoginView1.FindControl("hylkOffMStudyStics") as HyperLink;
                    HyperLink hylkOffFairsStics = LoginView1.FindControl("hylkOffFairsStics") as HyperLink;

                    EcsOfficeBLL offAPI = new EcsOfficeBLL();
                    EcsSiteDS.EcsOfficDataTable offTable =
                        offAPI.GetEcsOfficeByEmail(Membership.GetUser(Page.User.Identity.Name).Email);
                    if (offTable.Count != 0)
                    {
                        EcsSiteDS.EcsOfficRow offrow = offTable[0];

                        hylkOffExpOppStics.NavigateUrl =
                            hylkOffTenderStics.NavigateUrl =
                            hylkOffMStudyStics.NavigateUrl =
                            hylkOffFairsStics.NavigateUrl =
                            Helper.NavURLParamsStringVirtualName(offrow.City_nmen,
                            Globals.Settings.VirtualNamesInfo.OfficeStics, true);
                    }
                }
                else if (Roles.IsUserInRole(Page.User.Identity.Name, RolesName.SysAdmin.ToString())
                    || Roles.IsUserInRole(Page.User.Identity.Name, RolesName.AdminSystem.ToString()))
                {
                    HyperLink hylkDepExpOppStics = LoginView1.FindControl("hylkDepExpOppStics") as HyperLink;
                    HyperLink hylkDepTenderStics = LoginView1.FindControl("hylkDepTenderStics") as HyperLink;
                    HyperLink hylkDepMStudyStics = LoginView1.FindControl("hylkDepMStudyStics") as HyperLink;
                    HyperLink hylkDepFairsStics = LoginView1.FindControl("hylkDepFairsStics") as HyperLink;

                    DeprtCategoryBLL depAPI = new DeprtCategoryBLL();
                    EcsSiteDS.DepCategoryDataTable depTable =
                        depAPI.GetDepCategoryByEmail("info@ecs.gov.eg");
                    if (depTable.Count != 0)
                    {
                        EcsSiteDS.DepCategoryRow deprow = depTable[0];
                        hylkDepExpOppStics.NavigateUrl =
                          hylkDepTenderStics.NavigateUrl =
                          hylkDepMStudyStics.NavigateUrl =
                          hylkDepFairsStics.NavigateUrl =
                            Helper.NavURLParamsStringVirtualName(deprow.DepCat_NameEn,
                            Globals.Settings.VirtualNamesInfo.DepStics, true);
                    }
                }
            }
            #endregion
        }
    }
}
